package com.stan.core.spark.userAction;

import java.io.Serializable;

public class ComparableCategoryObject
    implements Comparable<ComparableCategoryObject>, Serializable {
    String categoryId;
    Long clickCategoryCount;
    Long orderCategoryCount;
    Long defrayCategoryCount;


    @Override
    public int compareTo(ComparableCategoryObject o) {
        long compareNum =
                (this.defrayCategoryCount - o.defrayCategoryCount) * 10000
                        +
                        (this.orderCategoryCount - o.orderCategoryCount) * 100
                        +
                        (this.clickCategoryCount - o.clickCategoryCount) * 1;
        return (int)(compareNum%1000);
    }

    @Override
    public String toString() {
        return "ComparableCategoryObject{" +
                "categoryId='" + categoryId + '\'' +
                ", clickCategoryCount=" + clickCategoryCount +
                ", orderCategoryCount=" + orderCategoryCount +
                ", defrayCategoryCount=" + defrayCategoryCount +
                '}';
    }

    public String getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    public Long getClickCategoryCount() {
        return clickCategoryCount;
    }

    public void setClickCategoryCount(Long clickCategoryCount) {
        this.clickCategoryCount = clickCategoryCount;
    }

    public Long getOrderCategoryCount() {
        return orderCategoryCount;
    }

    public void setOrderCategoryCount(Long orderCategoryCount) {
        this.orderCategoryCount = orderCategoryCount;
    }

    public Long getDefrayCategoryCount() {
        return defrayCategoryCount;
    }

    public void setDefrayCategoryCount(Long defrayCategoryCount) {
        this.defrayCategoryCount = defrayCategoryCount;
    }
}
